package dbLayer;

import java.sql.SQLException;
import java.util.List;

import modelLayer.Subject;
import modelLayer.Teacher;

public interface DBSubjectIF {
	
	
	/**
	 * Inserts a new row into the database table. This method
	 * uses prepared statements to sanitize our database inputs. 
	 * 
	 * @param 	name			String		name of the subject
	 * @param 	description		String		subject description
	 * @param	t				Teacher		teacher to be associated with the subject
	 * @return 	rc 				int 		count of rows affected by the query execution in the database	
	 * @throws 					Exception
	 */
	public int insert(String name, String description) throws SQLException;
	
	/**
	 * Finds  a subject in the database table Subject.
	 * 
	 * @param 	name				String	name of the subject
	 * @param 	retrieveAssociation	determines if we're to retrieve additional information on the subject
	 * @return
	 * @throws 						Exception
	 */
	public Subject find(String name, boolean retrieveAssociation) throws Exception;
	
	/**
	 * Finds  a subject in the database table Subject.
	 * 
	 * @param 	id					int		id of the subject
	 * @param 	retrieveAssociation	boolean	determines if we're to retrieve additional information on the subject
	 * @return
	 * @throws 						Exception
	 */
	public Subject findById(int id, boolean retrieveAssociation) throws Exception;
	
	/**
	 * Finds all rows in the database table Subject
	 *  
	 * @param 	retrieveAssociation	boolean			determines if we're to retrieve additional information 
	 * 												on the subject
	 * @return 						List<Subject> 	list of subjects
	 */
	public List<Subject> getAll(boolean retrieveAssociation);
	
	/**
	 * Updates a row in the database table Subject.
	 * 
	 * @param 	id				int		Subject id, as allocated in the database
	 * @param 	newName			String	new subject name
	 * @param 	newDescription	String	new subject description
	 * @return	rc				int		count of rows affected by the query execution in the database
	 * @throws 					Exception
	 */
	public int update(int id, String newName, String newDescription) throws SQLException;
	
	/**
	 * Removes a row in the database table Subject.
	 * 
	 * @param 	name			String	subject name
	 * @return	rc				int		count of rows affected by the query execution in the database
	 * @throws 					Exception
	 */
	public int remove(String name) throws SQLException;
	
}